package muilty_thread.pic_java_design_pattern.SingleThreadedExecution;

/**
 * @version: 1.0
 * @Description: TODO
 * @author: zZmH
 * @date: 2020/09/09 19:16
 */


public class UserThread extends Thread {

    private final Gate gate;
    private final String myName;
    private final String myAddress;


    public UserThread(Gate gate, String myName, String myAddress) {
        this.gate = gate;
        this.myName = myName;
        this.myAddress = myAddress;
    }

    @Override
    public void run(){
        System.out.println(myName + "BEGIN");
        while (true) {
            gate.pass(myName, myAddress);
        }
    }
}
